
from elasticsearch import Elasticsearch

# 创建 Elasticsearch 客户端
es = Elasticsearch(["http://172.16.226.131:9200"], http_auth=("elastic", "WlkO3gkQsjUvIPhamhqc"))

# 测试连接
if es.ping():
    print("Connected to Elasticsearch!")
else:
    print("Failed to connect to Elasticsearch.")